	var wnd = null;
	
	
	if(JiraLocalStorage.getItem("url") != '')
	{
		jira_loader.url = JiraLocalStorage.getItem("url");
		jira_loader.login(JiraLocalStorage.getItem("username"), JiraLocalStorage.getItem("password"), function(){
			jira_loader.update();
		});
	} else {
		

	}

	function OpenJiraWindow(){

				var box = document.getBoxObjectFor(document.getElementById("nav-bar"));
				var pos = {
					x: (box.screenX + box.width - 750),
					y: (box.screenY + box.height)
				}

				
			wnd = Components.classes['@mozilla.org/embedcomp/window-watcher;1']  
			  .getService(Components.interfaces.nsIWindowWatcher)  
			  .openWindow(window, 'chrome://jira/content/bubble.xul',  
					  '_blank', 'chrome,dependent=yes,titlebar=no', null);
			wnd.arguments = [jira_loader, pos];
	}
	
	window.addEventListener("focus",function(){
		if(wnd && !wnd.closed)
			wnd.close();
	},true);
